package edu.spec.dengyan.week08.class01.book.unit4.topic03;

/**
 * Author       : Dengyan
 * Date         : 2018/10/11 23:19
 * Description  : “Person”类
 */
public class Person {
    private String name;
    private char sex;
    private  int age;
    //2个重载
    public Person(){
        //空构造
    }
    public Person(String s){//设置姓名
        this.name=s;
    }
    public Person(String name,char sex,int age){
        this.name=name;
        this.sex=sex;
        this.age=age;
    }
    //获得姓名、性别和年龄利用定义的Person类
    public String toString(){

        return this.getName()+" "+this.getSex()+" "+this.getAge();
    }

    public static void main(String[] args) {
        Person l=new Person("娜娜",'女',20);
        System.out.println(l.toString());
    }

    public String getName() {
        return name;
    }

    public char getSex() {
        return sex;
    }

    public int getAge() {
        return age;
    }
}
